const mongoose = require('mongoose');
const shopsModel = require('./shopsModel')
const adminModle = require('./adminModle')
const goodsSchema = new mongoose.Schema({
    name: String, // 商品名称
    classify: Array, // 商品分类 ['苹果','香蕉','西瓜'....]
    price: String, // 价格
    production: String, // 生产日期
    publishing: String, // 产地
    images: Array,
    poster: String,
    desc: String, // 简介
    adminId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: adminModle
    },
    shopsId: [
        {
            type: mongoose.Schema.Types.ObjectId,
            ref: shopsModel
        }
    ], // 所属门店id
    isAvail: Number, // 商品上架前是否通过审核（0：未通过；1：申请中；2：已通过）
})
module.exports = mongoose.model('goodsModel', goodsSchema, 'goods');